package thread;

/**
 * 线程的优先级
 * 10个优先级，分别用整数1-10表示
 * 其中1为最低，10为最大，5为默认优先级
 *
 */
public class PriorityDemo {
    public static void main(String[] args) {
        Thread min = new Thread(){
            public void run(){
                for (int i = 0; i < 10000; i++){
                    System.out.println("min");
                }
            }
        };

        Thread max = new Thread(){
            public void run(){
                for (int i = 0; i < 10000; i++){
                    System.out.println("max");
                }
            }
        };

        Thread norm = new Thread(){
            public void run(){
                for (int i = 0; i < 10000; i++){
                    System.out.println("norm");
                }
            }
        };
        min.setPriority(Thread.MIN_PRIORITY);//设计为最低优先级(1)
        max.setPriority(Thread.MAX_PRIORITY);//设计为最高优先级(10)
        min.start();
        max.start();
        norm.start();

















    }
}

